package com.zhuiyun.project.api.wxlogin.service;


import com.zhuiyun.project.api.wxlogin.entiy.WxLoginVo;
import com.zhuiyun.project.api.wxlogin.entiy.WxUser;
import com.zhuiyun.project.api.appuser.model.AppUserModel;
import com.zhuiyun.project.api.appuser.entity.User;
import com.zhuiyun.project.common.response.CommonResult;

import java.io.IOException;

/**
 * @Description TODO 小程序微信授权登录
 * @ClassName UserLoginService
 * @Author HH
 * @Date 2023/4/3 18:22
 **/
public interface WxLoginService {
    /**
     * @param
     * @Author kdj
     * @Description 用户首次登录
     * @Date 2023/6/17 20:03
     * @Return com.zhuiyun.project.api.appuser.entiy.User
     */
    User addUserFirst(User user);

    /**
     * @Description 获取openid
     * @Author HH
     * @Date 2023/4/11 8:38
     * @Return java.lang.String
     */
    CommonResult getOpenid(String code) throws IOException;


    /**
     * @param user
     * @Description 小程序微信授权用户登录
     * @Author HH
     * @Date 2023/4/10 18:47
     * @Return com.zhuiYun.project.common.response.CommonResult
     */
    CommonResult login(AppUserModel user);


    /**
     * @param phone
     * @Description 腾讯云发送手机短信
     * @Author HH
     * @Date 2023/4/12 9:43
     * @Return com.zhuiYun.project.common.response.CommonResult
     */
    CommonResult sendPhoneCode(String phone);

    /**
     * @param phone
     * @param code
     * @Description 判断手机短信验证码是否正确
     * @Author HH
     * @Date 2023/4/12 13:56
     * @Return com.zhuiYun.project.common.response.CommonResult
     */
    CommonResult verificationCode(String phone, String code);


    /**
     * @param wxLoginVo
     * @Author kdj
     * @Description 微信快捷登录
     * @Date 2023/6/17 17:12
     * @Return com.zhuiyun.project.common.response.CommonResult
     */
    CommonResult getPhoneNum(WxLoginVo wxLoginVo);


    /**
     * @param phone
     * @Author kdj
     * @Description 根据phone获取user
     * @Date 2023/6/19 14:31
     * @Return com.zhuiyun.project.api.appuser.entiy.User
     */
    User getUserByPhone(String phone);

    /**
     * @Author kdj
     * @Description 根据openid判断wx用户是否存在
     * @Date 2023/6/19 15:59
     * @Return com.zhuiyun.project.api.wxlogin.entiy.WxUser
     * @param openId
     */
    WxUser queryWxUserByOpenId(String openId);
}
